﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using PhysicsEngine.Common;

namespace PhysicsEngine.Collision
{
  /// <summary>
  /// Represents an Axis Aligned Bounding Box for use in broadphase and narrowphase collision detection.
  /// </summary>
  public class AABB
  {
    public Vector2 Min { get; private set; }
    public Vector2 Max { get; private set; }

    public AABB(Vector2 min, Vector2 max)
    {
      Contract.Ensures(Min == min);
      Contract.Ensures(Max == max);

      Min = min;
      Max = max;
    }

    [ContractInvariantMethod]
    private void ObjectInvariant()
    {
      Contract.Invariant(Min != null);
      Contract.Invariant(Max != null);
    }
  }
}
